home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
026a
/
atbbsdbf.zip
/
PORTLIST.PRG
< prev
next >
Wrap
Text File
|
1990-12-14
|
8KB
|
291 lines
SET TALK OFF
SET ECHO OFF
SET SAFETY OFF
CLEAR
SELECT 1
USE ATBBS ORDER LOCATION
SELECT 2
USE TEMPATBB
ZAP
SELECT 3
USE READFILE
ZAP
*----- Import the data
? "Importing file list from 'FILES.'..."
APPEND FROM FILES. TYPE SDF
? "Importing complete..."
DELAY = INKEY(3)
CLEAR
*----- Mark all blank records and all column heading records
*----- for deletion and then delete them
? "Beginning first pass deletion..."
? "Marking blank records for deletion..."
DELETE ALL FOR LEN(TRIM(FILE_NAME)) = 0
? "Marking 'First Column Heading' records for deletion..."
DELETE ALL FOR RTRIM(LTRIM(FILE_NAME)) + RTRIM(LTRIM(BYTES)) = "FileBytes"
? "Marking 'Second Column Heading' records for deletion..."
DELETE ALL FOR RTRIM(LTRIM(FILE_NAME)) = "----"
? "Marking records for deletion 'first pass' complete..."
? "Removing records marked for deletion..."
PACK
? "Removal complete..."
DELAY = INKEY(3)
CLEAR
*----- Check for "LATEST ADDITIONS" section in file.
*----- If it was found then delete the section heading and
*----- save the first record number after the heading.
*----- Pack the file and calculate the position of the
*----- first record in the "LATEST ADDITIONS" section.
? "Beginning second pass deletion..."
LOCATE FOR FILE_NAME = "LATEST ADDITIONS"
IF FOUND()
DELETE NEXT 3
STORE RECNO() + 1 TO MNEWLIST
? "Removing records marked for deletion..."
PACK
? "Removal complete..."
STORE MNEWLIST - RECCOUNT() TO MNEWLIST
STORE RECCOUNT() - MNEWLIST TO MNEWLIST
ELSE
? "Second pass complete..."
STORE RECCOUNT() TO MNEWLIST
ENDIF
DELAY = INKEY(3)
CLEAR
*----- Copy all records from the READFILE.DBF to the TEMPATBB.DBF
*----- and add the library location of the file to the new record.
SET EXACT ON
GO TOP
?
? "Copying records and appending Library name to record..."
?
?
DO WHILE .T.
*----- Displays pretties...
IF MOD(RECNO(),25) = 0
?? "*"
ENDIF
IF MOD(RECNO(),500) = 0
?
ENDIF
*----- If current record is the beginning of "LATEST ADDITIONS"
*----- section then exit the loop and continue with the program.
IF RECNO() = MNEWLIST + 1 .OR. EOF()
EXIT
ENDIF
*----- Determine if the current record is a file listing
*----- or a LIBRARY header. If it is a LIBRARY header then
*----- get the library name from the header otherwise copy
*----- this record to the TEMPATBB.DBF file.
IF FILE_NAME = 'FILE DIRECTORY OF'
MLIB = GETLIB()
ELSE
IF NOCOPY(mlib)
SKIP
LOOP
ENDIF
SELECT 2
APPEND BLANK
SELECT 3
REPLACE B->LIBRARY WITH MLIB
REPLACE B->FILE WITH LTRIM(FILE_NAME)
REPLACE B->BYTES WITH SPACE(8-LEN(RTRIM(LTRIM(BYTES)))) + RTRIM(LTRIM(BYTES))
REPLACE B->SOURCE WITH LTRIM(SOURCE)
REPLACE B->DESCRIP WITH LTRIM(DESCRIP)
REPLACE B->NEW WITH .T.
REPLACE B->DOWNLOADED WITH .F.
ENDIF
SKIP
ENDDO
*----- This loop will copy the "LATEST ADDITIONS" section
*----- to the TEMPATBB.DBF. This is required because the
*----- "LATEST ADDITIONS" section is formated a bit
*----- different than the rest of the database.
DO WHILE .NOT. EOF()
MSTR = FILE_NAME + BYTES + SOURCE + DESCRIP
IF NOCOPY(RTRIM(LTRIM(FIND1ST())))
SKIP
LOOP
ENDIF
SELECT 2
APPEND BLANK
REPLACE LIBRARY WITH FIND1ST()
MSTR = KILL1ST()
REPLACE FILE WITH FIND1ST()
MSTR = KILL1ST()
REPLACE BYTES WITH FIND1ST()
REPLACE BYTES WITH SPACE(8-LEN(RTRIM(LTRIM(BYTES)))) + RTRIM(LTRIM(BYTES))
MSTR = KILL1ST()
REPLACE SOURCE WITH FIND1ST()
MSTR = KILL1ST()
REPLACE DESCRIP WITH MSTR
REPLACE NEW WITH .T.
REPLACE DOWNLOADED WITH .F.
SELECT 3
SKIP
ENDDO
?
?
? "Copying complete..."
DELAY = INKEY(3)
*----- We are finished with the READFILE.DBF. Now lets work
*----- on the TEMPATTB.DBF and copy all new records (those that
*----- do not already exist) into the ATBBS.DBF
SELECT 2
CLEAR
*----- First, let's remove all occurences of the
*----- 'FILES.' and 'INDEX.' entries. These are
*----- in every library and we really don't need them.
*----- At least I don't think we do.
? "Cleaning up database..."
DELETE ALL FOR TRIM(FILE) = 'FILES.' .OR. TRIM(FILE) = 'INDEX.'
PACK
? "Clean up is complete..."
DELAY = INKEY(3)
CLEAR
*----- Locate all records that are in both database and change the
*----- 'NEW' field to reflect this finding.
? "Locating and marking duplicate records..."
?
?
SET ORDER TO LOCATION
SET RELATION TO TRIM(LIBRARY) + TRIM(FILE) INTO ATBBS
SCAN
IF MOD(RECNO(),25) = 0
?? "*"
ENDIF
IF MOD(RECNO(),500) = 0
?
ENDIF
IF ATBBS->LIBRARY + ATBBS->FILE = LIBRARY + FILE
REPLACE NEW WITH .F.
ENDIF
ENDSCAN
? "Locating and marking complete..."
DELAY = INKEY(3)
CLEAR
*----- Copy all the new records from the TEMPATBB.DBF into the ATBBS.DBF
? "Copying new records..."
SET RELATION TO
USE
SELECT 1
APPEND FROM TEMPATBB FOR NEW
? "Processing of records complete..."
DELAY = INKEY(3)
CLEAR
*-----Print routine
MANSWER = [ ]
? 'Do you want a print out of all NEW files [Y/N]'
DO WHILE .NOT. MANSWER $ [YN]
@ 1,53 GET MANSWER PICTURE [!]
READ
ENDDO
IF MANSWER = [Y]
CLEAR
? "Printing report..."
SET CONSOLE OFF
MPJECT = _PEJECT
MPLENGTH = _PLENGTH
_PEJECT = [NONE]
_PLENGTH = 60
REPORT FORM NEW TO PRINT FOR NEW
_PEJECT = MPEJECT
_PLENGTH = MPLENGTH
EJECT
SET CONSOLE ON
REPLACE ALL NEW WITH .F.
ENDIF
CLOSE ALL
CLEAR
RETURN
*-----This function will return the Library name from the current record.
FUNCTION GETLIB
MSTR = FILE_NAME + BYTES + SOURCE + DESCRIP
MSTR = SUBSTR(MSTR,AT("LIB",MSTR))
MSTR = SUBSTR(MSTR,AT(" ",MSTR)+1)
RETURN TRIM(SUBSTR(MSTR,1,AT(" ",MSTR)))
*-----This function will return all characters up to and
*-----including the first space.
FUNCTION FIND1ST
RETURN SUBSTR(MSTR,1,AT(" ",MSTR))
*-----This function will return a partial copy of the string
*-----sent. The returned value will exclude the first set of
*-----characters (all characters up to the first space) and all
*-----spaces up to the first character of the next set of characters.
FUNCTION KILL1ST
RETURN LTRIM(SUBSTR(MSTR,AT(" ",MSTR)))
*-----This function will return .T. if the file is not to be copied.
*-----You will need to fill in the CASE statements for the areas that
*-----define the files you do not want copied. I have included a sample.
*-----DEFAULT is all files WILL BE COPIED.
FUNCTION NOCOPY
parameters LIB_NAME
WILLCOPY = .F.
LIBN = TRIM(LIB_NAME)
DO CASE
*----- To specify files to EXCLUDE use these examples:
* CASE LIB-NAME = "FW2" && This will cause all files in the
* RETURN .T. && 'FW2' library to be skipped.
* CASE SUBSTR(LIB_NAME,1,1) = 'F' && All files in any library starting
* RETURN .T. && with 'F' will be skipped.
*----- To specify files to INCLUDE use these examples:
* CASE LIB_NAME = "FW2"
* RETURN .F.
* CASE SUBSTR(LIB_NAME,1,1) = 'F'
* RETURN .F.
ENDCASE
RETURN WILLCOPY